package org.wu.framework.lazy.orm.database.lambda.dynamic;


import org.wu.framework.lazy.database.datasource.proxy.LazyProxyDataSource;
import org.wu.framework.lazy.database.datasource.proxy.connection.LazyProxyConnection;
import org.wu.framework.lazy.orm.core.config.prop.LazyDataSourceAttribute;


import javax.sql.DataSource;
import java.sql.SQLException;

/**
 * 动态数据源 适配器
 *
 * @author : Jia wei Wu
 * @version : 1.0
 * @date : 2022/1/29 20:10
 */
public interface DynamicDatasourceAdapter {

    /**
     * describe 确定数据源
     *
     * @param
     * @return
     * @author Jia wei Wu
     * @date 2021/7/4 6:19 下午
     **/
    LazyProxyDataSource determineDataSource();

    /**
     * 确定数据源连接对象
     *
     * @return 数据源连接对象
     * @see DynamicDatasourceAdapter#determineDataSource()
     */
    LazyProxyConnection determineConnection() throws SQLException;

    /**
     * 数据源载入
     *
     * @param sourceProperties 数据源参数
     */
    void loading(LazyDataSourceAttribute sourceProperties);

}
